import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';

///Flexible 组件可以控制 Row、Column、Flex 的子控件占满父组件，比如，Row 中有3个子组件，两边的宽是100，中间的占满剩余的空间，
class FiexWidget extends StatelessWidget {
  FiexWidget({Key ?key, @required this.text}) : super(key: key);
  final String ?text;

  @override
  Widget build(BuildContext context) {
    return Scaffold(
        appBar: AppBar(
          title: Text(text??""),
        ),
        body: Column(
          children: [
            Row(
              children: <Widget>[
                Container(
                  color: Colors.blue,
                  height: 50,
                  width: 100,
                ),
                Flexible(
                    child: Container(
                  alignment: Alignment.center,
                  color: Colors.red,
                  height: 50,
                  child: Text("对齐"),
                )),
                Container(
                  color: Colors.blue,
                  height: 50,
                  width: 100,
                ),
              ],
            ),
            SizedBox(
              height: 20,
            ),

          ],
        ));
  }
}
